﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RCTools;

namespace exercice3
    {
    class Program
        {
        static void Main(string[] args)
            {
            float a = 10.5f;
            double b = 3.1415926;
            System.Console.WriteLine(a + " - " + b);
            swap(ref a, ref b);
            System.Console.WriteLine(a + " - " + b);

            System.Console.WriteLine("");

            String stra = "raph";
            String strb = "toto";
            System.Console.WriteLine(stra + " - " + strb);
            swap(ref stra, ref strb);
            System.Console.WriteLine(stra + " - " + strb);

            System.Console.WriteLine("");

            int[] taba = new int[] { 1, 2, 3, 4, 5 };
            int[] tabb = new int[] { 14, 15, 16, 17, 18 };
            RCTools.Container.displayTab(taba);
            RCTools.Container.displayTab(tabb);
            swap(ref taba, ref tabb);
            RCTools.Container.displayTab(taba);
            RCTools.Container.displayTab(tabb);

            System.Console.ReadKey();
            }

        static void swap(ref float a, ref double b)
            {
            float temp = 0;
            temp = a;
            a = (float)b;
            b = temp;
            }

        static void swap(ref String a, ref String b)
            {
            String tmp = a;
            a = b;
            b = tmp;
            }

        static void swap(ref int[] a, ref int[] b)
            {
            if (a.Count() != b.Count())
                {
                System.Console.WriteLine("the tabs are not the same size !");
                }
            else
                {
                int[] tmp = a;
                a = b;
                b = tmp;
                }
            }
        }
    }
